import Vue from 'vue'
import VueRouter from 'vue-router'
import News from '../views/News.vue'
import Index from '../views/Index.vue'
import Sports from '../views/Sports.vue'
import NotFound from "../views/NotFound.vue"

// 导入二级路由
import Cp from "../views/second/Cp.vue"
import Op from "../views/second/Op.vue"
import Ip from "../views/second/Ip.vue"


Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: "/index"
  },
  {
    path: '/index',
    name: 'Index',
    component: Index
  },
  {
    path: '/news',
    name: 'News',
    component: News
  },
  {
    path: '/sports',
    name: 'Sports',
    component: Sports,
    children: [{
        path: '/sports',
        redirect: "/sports/ip"
      }, {
        path: 'cp',
        component: Cp
      },
      {
        path: 'op',
        component: Op
      }, {
        path: 'ip',
        component: Ip
      }
    ]

  }, {
    path: "*",
    component: NotFound
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router